﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using CNRegex.Web.Base;
using CNRegex.Biz.BizAccess;
using CNRegex.Entity;
using CNRegex.Enum;
using CNRegex.Biz;

namespace CNRegex.Web.Controllers
{
	public class AdminRegexCategoryController : BaseController
	{
		private BizRegexCategory bizRegexCategory;
		public AdminRegexCategoryController()
		{
		}

		//
		// GET: /RegexCategory/

		public ActionResult Index()
		{
			IList<RegexCategory> list = bizRegexCategory.List(x => x.OrderIndex, Enum.EnumOrder.ASC);
			return View(list);
		}

		[HttpPost]
		public ActionResult Save(RegexCategory model)
		{
			bizRegexCategory.SaveOrUpdate(model);
			return Content(EnumOperationState.Success.ToString());
		}
		[HttpPost]
		public ActionResult Delete(Guid id)
		{
			bizRegexCategory.DeleteByID(id, NHibernate.NHibernateUtil.Guid);
			return Content(EnumOperationState.Success.ToString());
		}

	}
}
